package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.vo.DouyinVideoTotalVo;
import com.ruoyi.system.domain.DouyinVideo;
import com.ruoyi.system.mapper.DouyinVideoMapper;
import com.ruoyi.system.service.DouyinVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * (DouyinVideo)表服务实现类
 *
 * @author makejava
 * @since 2020-10-23 09:28:16
 */
@Service("douyinVideoService")
public class DouyinVideoServiceImpl implements DouyinVideoService {
    @Autowired
    private DouyinVideoMapper douyinVideoMapper;

    /**
     * 添加视频数据
     *
     * @param douyinVideos
     */
    public void batchAddVideo(List<DouyinVideo> douyinVideos) {
        douyinVideoMapper.batchAddVideo(douyinVideos);
    }

    /**
     * 本地视频列表
     *
     * @param openIds
     * @param userId
     * @return
     */
    @Override
    public List<DouyinVideo> getVideoList(List<String> openIds, String userId) {
        if (openIds.size() == 0) return null;
        return douyinVideoMapper.getVideoList(openIds, userId);
    }

    /**
     * 本地视频列表
     * 含有起止时间的
     *
     * @param openIds
     * @param userId
     * @param start
     * @param end
     * @return
     */
    @Override
    public List<DouyinVideo> getVideoListByData(List<String> openIds,
                                                String userId,
                                                Date start,
                                                Date end) {
        if (openIds.size() == 0) return null;
        return douyinVideoMapper.getVideoListByData(openIds, userId, start, end);
    }

    public DouyinVideoTotalVo totalNum(List<String> openIds, String userId) {
        if (openIds.size() == 0) return null;
        return douyinVideoMapper.totalNum(openIds, userId);
    }
}
